﻿@using ECG.Utility
@using ECG.WebUI.CustomHelpers
@using ECG.WebUI.Models
@model List<ECG.Common.ProductRateByCateTopListPagingDto>
<div class="Category-p-list">
    <div class="textTotalProduct clearfix">
        <h1 class="h-l3">@ViewBag.CateName</h1>
        @*<span class="countp">23 sản phẩm</span>*@
    </div>
    <div class="cate-box-codition clearfix">
        <div class="box-co-left fl">
            <i class="arrandCategory"></i>
            <ul class="litsCo ul">
                <li>
                    <span class="coFirst-text">Xem theo</span>
                </li>
                <li>
                    <a href="javascript:void(0);" rel="nofollow" idata="OEJHY" ileft="-19" class="tabFilActive">Mới nhất</a>
                </li>
                <li>
                    <a href="javascript:void(0);" rel="nofollow" idata="ACCEH" ileft="62">bán chạy</a>
                </li>
                <li>
                    <a href="javascript:void(0);" rel="nofollow" idata="GJUYR" ileft="142">giảm giá</a>
                </li>
            </ul>
        </div>
        <div class="box-co-right fl">
            <div class="coWrap">
                @*                <span class="coText">Hiển thị</span>
                <a href="javascript:void(0);" rel="nofollow" class="sortCol sortCol-ac"></a>
                <a href="javascript:void(0);" rel="nofollow" class="sortGrid sortGrid-ac"></a>*@
                <span class="coText2">Sắp xếp</span>
                @Html.DropDownList("selectSortCategory", new SelectList(CommonHelpers.selectSortCategory(), "Value", "Text", ViewBag.Fillter), new { @Class = "sortDrop" })
            </div>
        </div>
    </div>
    @{
    <div class="CoListProduct">
        @if (Model.Any())
        {
        <div>
            có <span id="totalRecord">@ViewBag.TotalRecod</span> sản phẩm
            <input type="hidden" class="hidRecordByPage" value="@ViewBag.RecordByPage" />
        </div>

        <ul class="listp ul clearfix">
            @foreach (var item in Model)
                {
                    var pDetailLink = Url.Action("Index", "ProductDetail", new { productId = item.Id, productName = StringUtil.RemoveSpecialCharactersVn(item.Name) });
                <li>
                    <div class="pItem">
                        <a href="@pDetailLink" class="pItem-lnkImg">
                            @if (item.PromotionPrice > 0)
                                {
                                <span class="pItem-per">-@item.DiscountPercentage.ToString("#.#")<i>%</i></span>
                                }
                            <img src="@item.ImagePath.ImagePathThumb(135, 135)" width="135" height="135" alt="@item.Name" class="lzLoading">
                        </a>
                        <div class="pItem-info">
                            <div style="line-height: 13px; margin-top: 5px;">
                                @{
                                string StarPercent = "0";
                                if (item.AverageRate > 0)
                                {
                                    StarPercent = (Convert.ToDouble(item.AverageRate) * 100 / 5).ToString("#.#").Replace(',', '.');
                                }
                                }
                                <span class="itm-ratStars inlineBlocka"><span style="width: @StarPercent%;" class="itm-ratStars itm-ratRating"></span></span>
                            </div>
                            <h2>
                                <a href="@pDetailLink">@item.Name</a>
                            </h2>
                            @if (item.PromotionPrice > 0)
                                {
                                <p class="pItem-PriceOld">
                                    @item.Price.ToString("##,###,###") đ
                                </p>
                                <p class="pItem-PriceNew">
                                    @item.PromotionPrice.ToString("##,###,###") <strong>đ</strong>
                                    <a href="javascript:void(0);" class="fbComment">Bình luận</a>
                                </p>
                                }
                                else
                                {
                                <p class="pItem-PriceNew">
                                    @item.Price.ToString("##,###,###") <strong>đ</strong>
                                    <a href="javascript:void(0);" class="fbComment">Bình luận</a>
                                </p>
                                }

                        </div>
                    </div>
                </li>
                }
        </ul>
        <div class="bb_pagging">
            @*<a href="javascript:void(0);" rel="nofollow">còn 22 sản phẩm - xem tiếp</a>*@
            @Html.PageLinksOnProductListCatePage((PageInfo)ViewBag.PageInfo, i => Url.Action("Index", "CategoryL3", new { page = i, sortdrop = ViewBag.Fillter, catefil = ViewBag.CateFill }))
        </div>
        }
    </div>
}
    <input type="hidden" value="@ViewBag.Category/@ViewBag.CurrentPage/@ViewBag.Fillter/@ViewBag.CateFill" id="hidFillData"/>
</div>
